commonlibsse_ng\re\i/
IAnimationGraphManagerHolder.rs

1//! # IAnimationGraphManagerHolder
2//!
3//! Represents the interface for managing animation graphs.
4//!
5//! Provides virtual functions for interacting with animation graphs and related operations.
6//!
7//! # Memory Layout:
8//! - `VTABLE`: Virtual function table pointer (0x0)
9
10use crate::re::BSAnimationGraphChannel::BSAnimationGraphChannel;
11use crate::re::BSAnimationGraphManager::BSAnimationGraphManager;
12use crate::re::BSFixedString::BSFixedString;
13use crate::re::BSTArray::BSScrapArray;
14use crate::re::BSTSmartPointer::BSTSmartPointer;
15use crate::re::BShkbAnimationGraph::BShkbAnimationGraph;
16use crate::re::NiAVObject::NiAVObject;
17use crate::re::SpellItem::SpellItem;
18use crate::re::offsets_rtti::RTTI_IAnimationGraphManagerHolder;
19use crate::re::offsets_vtable::VTABLE_IAnimationGraphManagerHolder;
20use crate::rel::id::VariantID;
21
22#[repr(C)]
23#[derive(Debug)]
24pub struct IAnimationGraphManagerHolder {
25    /// Virtual function table pointer.
26    /// Offset: `0x0`
27    vtable: *const IAnimationGraphManagerHolderVtbl,
28}
29
30const _: () = {
31    assert!(core::mem::size_of::<IAnimationGraphManagerHolder>() == 0x8);
32};
33
34impl IAnimationGraphManagerHolder {
35    /// Address & offset of the runtime type information (RTTI) identifier.
36    pub const RTTI: VariantID = RTTI_IAnimationGraphManagerHolder;
37
38    /// Address & offset of the virtual function table.
39    pub const VTABLE: [VariantID; 1] = VTABLE_IAnimationGraphManagerHolder;
40
41    /// # Panics
42    /// If vtable is null.
43    #[inline]
44    pub const fn vtable(&self) -> &IAnimationGraphManagerHolderVtbl {
45        unsafe { self.vtable.as_ref().expect("vtable must not be null") }
46    }
47
48    #[inline]
49    pub fn get_animation_graph_manager(&self) -> Option<BSTSmartPointer<BSAnimationGraphManager>> {
50        let mut out = BSTSmartPointer::default();
51        if (self.vtable().GetAnimationGraphManagerImpl)(self, &mut out) && !out.is_null() {
52            return Some(out);
53        };
54        None
55    }
56
57    #[commonlibsse_ng_derive_internal::relocate_fn(se_id = 37787, ae_id = 38736)]
58    pub fn add_cast_power(&mut self, power: *mut SpellItem) {}
59}
60
61/// The virtual function table for `IAnimationGraphManagerHolder`.
62///
63/// This struct defines function pointers to simulate the C++ virtual functions.
64#[repr(C)]
65#[derive(Debug)]
66pub struct IAnimationGraphManagerHolderVtbl {
67    /// Destructor.
68    pub CxxDrop: fn(this: &mut IAnimationGraphManagerHolder),
69
70    /// Virtual functions corresponding to the C++ methods.
71    pub NotifyAnimationGraph:
72        fn(this: &IAnimationGraphManagerHolder, event_name: &BSFixedString) -> bool,
73    pub GetAnimationGraphManagerImpl: fn(
74        this: &IAnimationGraphManagerHolder,
75        out: &mut BSTSmartPointer<BSAnimationGraphManager>,
76    ) -> bool,
77    pub SetAnimationGraphManagerImpl: fn(
78        this: &mut IAnimationGraphManagerHolder,
79        in_mgr: BSTSmartPointer<BSAnimationGraphManager>,
80    ) -> bool,
81    pub PopulateGraphNodesToTarget:
82        fn(this: &IAnimationGraphManagerHolder, nodes: &mut BSScrapArray<*mut NiAVObject>) -> bool,
83    pub ConstructAnimationGraph: fn(
84        this: &IAnimationGraphManagerHolder,
85        out: &mut BSTSmartPointer<BShkbAnimationGraph>,
86    ) -> bool,
87    pub Unk_06: fn(this: &IAnimationGraphManagerHolder),
88    pub Unk_07: fn(this: &IAnimationGraphManagerHolder),
89    pub SetupAnimEventSinks: fn(
90        this: &IAnimationGraphManagerHolder,
91        anim_graph: &BSTSmartPointer<BShkbAnimationGraph>,
92    ) -> bool,
93    pub Unk_09: fn(this: &IAnimationGraphManagerHolder),
94    pub CreateAnimationChannels: fn(
95        this: &IAnimationGraphManagerHolder,
96        channels: &mut BSScrapArray<BSTSmartPointer<BSAnimationGraphChannel>>,
97    ) -> bool,
98    pub PostCreateAnimationGraphManager: fn(
99        this: &IAnimationGraphManagerHolder,
100        anim_graph_mgr: &mut BSTSmartPointer<BSAnimationGraphManager>,
101    ),
102    pub Unk_0C: fn(this: &IAnimationGraphManagerHolder),
103    pub PostChangeAnimationManager: fn(
104        this: &IAnimationGraphManagerHolder,
105        arg1: &BSTSmartPointer<BShkbAnimationGraph>,
106        arg2: &BSTSmartPointer<BShkbAnimationGraph>,
107    ),
108    pub Unk_0E: fn(this: &IAnimationGraphManagerHolder),
109    pub GetGraphVariableCacheSize: fn(this: &IAnimationGraphManagerHolder) -> u32,
110    pub GetGraphVariableImpl1:
111        fn(this: &IAnimationGraphManagerHolder, name: &BSFixedString, out: &mut f32) -> bool,
112    pub GetGraphVariableImpl2:
113        fn(this: &IAnimationGraphManagerHolder, name: &BSFixedString, out: &mut i32) -> bool,
114    pub GetGraphVariableImpl3:
115        fn(this: &IAnimationGraphManagerHolder, name: &BSFixedString, out: &mut bool) -> bool,
116}
117
118impl Default for IAnimationGraphManagerHolderVtbl {
119    #[inline]
120    fn default() -> Self {
121        Self::new()
122    }
123}
124
125impl IAnimationGraphManagerHolderVtbl {
126    /// Creates a new default virtual table with stubbed functions.
127    pub const fn new() -> Self {
128        const fn CxxDrop(_this: &mut IAnimationGraphManagerHolder) {}
129
130        const fn NotifyAnimationGraph(
131            _this: &IAnimationGraphManagerHolder,
132            _event_name: &BSFixedString,
133        ) -> bool {
134            false
135        }
136
137        const fn GetAnimationGraphManagerImpl(
138            _this: &IAnimationGraphManagerHolder,
139            _out: &mut BSTSmartPointer<BSAnimationGraphManager>,
140        ) -> bool {
141            false
142        }
143
144        fn SetAnimationGraphManagerImpl(
145            _this: &mut IAnimationGraphManagerHolder,
146            _in_mgr: BSTSmartPointer<BSAnimationGraphManager>,
147        ) -> bool {
148            false
149        }
150
151        const fn PopulateGraphNodesToTarget(
152            _this: &IAnimationGraphManagerHolder,
153            _nodes: &mut BSScrapArray<*mut NiAVObject>,
154        ) -> bool {
155            false
156        }
157
158        const fn ConstructAnimationGraph(
159            _this: &IAnimationGraphManagerHolder,
160            _out: &mut BSTSmartPointer<BShkbAnimationGraph>,
161        ) -> bool {
162            false
163        }
164
165        const fn Unk_06(_this: &IAnimationGraphManagerHolder) {}
166
167        const fn Unk_07(_this: &IAnimationGraphManagerHolder) {}
168
169        const fn SetupAnimEventSinks(
170            _this: &IAnimationGraphManagerHolder,
171            _anim_graph: &BSTSmartPointer<BShkbAnimationGraph>,
172        ) -> bool {
173            true
174        }
175
176        const fn Unk_09(_this: &IAnimationGraphManagerHolder) {}
177
178        const fn CreateAnimationChannels(
179            _this: &IAnimationGraphManagerHolder,
180            _channels: &mut BSScrapArray<BSTSmartPointer<BSAnimationGraphChannel>>,
181        ) -> bool {
182            false
183        }
184
185        const fn PostCreateAnimationGraphManager(
186            _this: &IAnimationGraphManagerHolder,
187            _anim_graph_mgr: &mut BSTSmartPointer<BSAnimationGraphManager>,
188        ) {
189        }
190
191        const fn Unk_0C(_this: &IAnimationGraphManagerHolder) {}
192
193        const fn PostChangeAnimationManager(
194            _this: &IAnimationGraphManagerHolder,
195            _arg1: &BSTSmartPointer<BShkbAnimationGraph>,
196            _arg2: &BSTSmartPointer<BShkbAnimationGraph>,
197        ) {
198        }
199
200        const fn Unk_0E(_this: &IAnimationGraphManagerHolder) {}
201
202        const fn GetGraphVariableCacheSize(_this: &IAnimationGraphManagerHolder) -> u32 {
203            0
204        }
205
206        const fn GetGraphVariableImpl1(
207            _this: &IAnimationGraphManagerHolder,
208            _name: &BSFixedString,
209            _out: &mut f32,
210        ) -> bool {
211            false
212        }
213
214        const fn GetGraphVariableImpl2(
215            _this: &IAnimationGraphManagerHolder,
216            _name: &BSFixedString,
217            _out: &mut i32,
218        ) -> bool {
219            false
220        }
221
222        const fn GetGraphVariableImpl3(
223            _this: &IAnimationGraphManagerHolder,
224            _name: &BSFixedString,
225            _out: &mut bool,
226        ) -> bool {
227            false
228        }
229
230        Self {
231            CxxDrop,
232            NotifyAnimationGraph,
233            GetAnimationGraphManagerImpl,
234            SetAnimationGraphManagerImpl,
235            PopulateGraphNodesToTarget,
236            ConstructAnimationGraph,
237            Unk_06,
238            Unk_07,
239            SetupAnimEventSinks,
240            Unk_09,
241            CreateAnimationChannels,
242            PostCreateAnimationGraphManager,
243            Unk_0C,
244            PostChangeAnimationManager,
245            Unk_0E,
246            GetGraphVariableCacheSize,
247            GetGraphVariableImpl1,
248            GetGraphVariableImpl2,
249            GetGraphVariableImpl3,
250        }
251    }
252}